function get_vkMusic(user_id) {		
	var d = $.Deferred();
	VK.Api.call('audio.getCount', { oid: user_id }, function(count) {			
		VK.Api.call('audio.get', { uid: user_id , count : 20  }, function(music_data) {						
			d.resolve(music_data.response);
		});				
	});
	return d;
}

function prepare_vkMusic(music_arr) {
	var myArray = [];
	
	for (var i in music_arr) {	
		myArray.push({title: music_arr[i].artist + ' - ' + music_arr[i].title, mp3: music_arr[i].url});	
		
		//$(".archive").append(
		//$("<h2/>").append(  $("<span/>").html(music_arr[i].artist + ' - ' + music_arr[i].title)  ));
		
		//alert(music_arr[i].artist);

	}
	
	var myPlaylist = new jPlayerPlaylist({jPlayer: "#jquery_jplayer_1",cssSelectorAncestor: "#jp_container_1"});				
	
	myPlaylist.setPlaylist(myArray);
	
}


$(function() {	
	$(".tab-music").click(function() {
		//alert(3333);	
		get_vkMusic(155135124).done(function(n) { 
			prepare_vkMusic(n);
			//alert(123);
		});		
	});
});


